#ifndef MOVEMENT_H
#define MOVEMENT_H

#include <linux/device.h>

#include "pwm.h"

#define MOTOR_PWM_PERIOD (1000000000 / 25000)    // (1s / freq hz)

struct motor_device
{
	struct device device;
	struct device_attribute value_attr;
	int value;
	gpio_pwm_desc *pwm_pin;
	gpio_pwm_desc *rev_pin;
	unsigned int enable_pin;
};

struct servo_device
{
	struct device device;
	struct device_attribute attr;
	gpio_pwm_desc *desc;
	int value;
	int enabled;
};

struct motor_device* motor_init(unsigned int, unsigned int, unsigned int, char *name, struct device *parent);
void motor_release(struct motor_device *dev);

struct servo_device* servo_init(unsigned int gpio_pin, char *name, struct device *parent);
void servo_release(struct servo_device *dev);

#endif
